Skip to content

fix: place the Switch thumb by its center, as MD3 does - #4

Merged
raajnadar merged 1 commit into
mainfrom
fix/switch-md3-thumb
Nov 14, 2026
Merged

raajnadar merged 1 commit into
mainfrom
fix/switch-md3-thumb

Conversation

@raajnadar

@raajnadar raajnadar commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Summary

The Switch thumb kept its start edge fixed. MD3 places the thumb by its center, so the off thumb sat too close to the edge, and a press grew it toward the end only. This PR places the thumb by its center.

Changes

  • The thumb center sits 16 dp from the start edge when off and 36 dp when on. The 16 dp off thumb now sits 8 dp from the edge, not 4 dp.
  • A press grows the thumb to 28 dp around its center. Before, a press on an on switch pushed the thumb over the end of the outline.
  • One spring drives the thumb size toward one target: 28 pressed, 24 on or with unselectedIcon, 16 off. Before, two springs added their undershoots, and the thumb shrank to 13.3 dp at the end of a toggle off.
  • The press grow springs instead of snapping, the same as the current Compose Switch.
  • The halo stays centered on the thumb.

Test plan

  • Lint, types and related tests pass on the changed files
  • 7 new thumb geometry tests in Switch.test.tsx fail when the old offset is put back
  • Full pnpm run test and pnpm run build (CI)
  • Verified in the example app on the iOS simulator, recorded frame by frame before and after
  • RTL, landscape and Android not checked on a device

Screenshots

Left: before. Right: after. Rows: off at rest, pressed while on, end of a toggle off.

@raajnadar
raajnadar merged commit 44394d8 into main Nov 14, 2026
5 checks passed
@raajnadar
raajnadar deleted the fix/switch-md3-thumb branch November 14, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant